<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			function foo(n){
				var result=0;
				for(var i=1;i<=n;i++){
					result+=i;
				}
				return result;
			}
			document.write(foo(100)+"<br />");
			
			function foo2(n){
				var result=1;
				for(var i=1;i<=n;i++){
					result*=i;
				}
				return result;
			}
			document.write(foo2(10)+"<br />");
			
			function foo3(n){
				if(n>1){
					return n*foo3(n-1);
				}else{
					return 1;
				}
			}
			document.write(foo3(10)+"<br />");
		</script>
	</body>
</html>
